﻿@using GoodMan.Infrastructure.Entities.Entity;
@{
    ViewBag.Title = "新增管理员";
    Layout = "~/Areas/WorkSpace/Views/Shared/_AdminTemplete.cshtml";
    List<Dormitory> dormitoryList = ViewBag.DormitoryList;
    
}
@section head{
    <style type="text/css">
        .nav .active
        {
            /*background: url(<?php echo $this->img('manage_r2_c13.jpg');?>) no-repeat;*/
            background-color: #F5F5F5;
        }
        .nav .other
        {
            /* background: url(<?php echo $this->img('manage_r2_c14.jpg');?>) no-repeat;*/
            background-color: #E9E9E9;
        }
        h2.nav
        {
            border-bottom: 1px solid #B4C9C6;
            font-size: 13px;
            height: 25px;
            line-height: 25px;
            margin-top: 0px;
            margin-bottom: 0px;
        }
        h2.nav a
        {
            color: #999999;
            display: block;
            float: left;
            height: 24px;
            width: 113px;
            text-align: center;
            margin-right: 1px;
            margin-left: 1px;
            cursor: pointer;
        }
    </style>
}
    <link type="text/css" rel="Stylesheet" href="/content/css/select2.css" />
<div id="content-header">
    <h1>
        添加人员</h1>
</div>
<div id="breadcrumb">
    <a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>首页</a>
    <a href="#" class="tip-bottom">人员管理</a> <a href="/workspace/Admin/UserInfoList" class="current">
        人员信息</a> <a href="#" class="current">添加/编辑</a>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon"><i class="icon-align-justify"></i></span>
                    <h5>
                        添加用户</h5>
                </div>
                <div class="widget-content nopadding">
                    <form id="regform" action="/workspace/admin/newuser" method="post" name="regform" class="form-horizontal">
                    <div id="tab1">
                     
                        <div class="control-group">
                        <table border="0" style="width:80%">
                        <tr style="height:50px;">
                        <td style="width:80px; padding-right:20px;" align="right">
                                角色(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                <select name="SystemRole" id="SystemRole" style="width: 150px;">
                                    <option value="11">学校管理员</option>
                                    <option value="20">超级财务人员</option>
                                </select>
                            </td>
                        <td style="width:80px; padding-right:20px;" align="right">
                                学院(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                <input type="text" class="span4 {required:true}" id="Departments" class="span4" style="width: 250px"
                                    name="Departments" placeholder="请输入您所在学院" />
                            </td>
                        </tr></table>                          
                            
                        </div>
                        <div class="control-group">
                        <table border="0" style="width:80%">
                        <tr style="height:50px;">
                        <td style="width:80px; padding-right:20px;" align="right">
                                账 户(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                 <input type="text" placeholder="请输入您的邮箱作为登录帐号" name="UserName" style="width: 200px" 
                                    class="span4 {required:true,regexp:'/^[^@Html.Raw("@")]{3,}$/',remote:{url:'/workspace/admin/usernameonly'},messages:{remote:'用户名已存在'}}" />&nbsp;&nbsp;@Html.Raw("@xiao-life.com")
                            
                            </td>
                        <td style="width:80px; padding-right:20px;" align="right">
                                班 级(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                <input type="text" class="span4 {required:true}" id="Classes" style="width: 250px"
                                    name="Classes" placeholder="请输入您的班级" />                            
                            </td>
                        </tr></table>  
                        </div>
                        <div class="control-group">
                        <table border="0" style="width:80%">
                        <tr style="height:50px;">
                        <td style="width:80px; padding-right:20px;" align="right">
                                密 码(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                 <input type="password" class="span4 {required:true,strongpwd:true, minlength:6,maxlength:18}" id="txtpassword"
                                    name="Password" placeholder="请输入帐号密码"  style="width: 250px" />
                            </td>
                        <td style="width:80px; padding-right:20px;" align="right">
                                 所属楼栋(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                <select name="FloorId" id="FloorId" style="width: 150px;">                                
                                @{
                                    if (dormitoryList != null && dormitoryList.Count!=0){
                                        foreach (var item in dormitoryList)
                                        {
                                    <option value="@item.Id">@item.Name</option>
                                            
                                        }
                                    }
                                    }
                                </select>                           
                            </td>
                        </tr></table>  
                            
                        </div>
                        <div class="control-group">
                        <table border="0" style="width:80%">
                        <tr style="height:50px;">
                        <td style="width:80px; padding-right:20px;" align="right">
                                确认密码(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                 <input type="password" class="span4 {required:true,equalTo:'#txtpassword'}" id="txtconfrim"
                                    name="Confirm" placeholder="请输入帐号密码"  style="width: 250px" />
                            </td>
                        <td style="width:80px; padding-right:20px;" align="right">
                                寝室号(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                <input type="text" class="span4" id="txtDormitory" class="span4 {required:true}" style="width: 250px"
                                    name="Dormitory" placeholder="请输入您的寝室号" />                        
                            </td>
                        </tr></table> 
                        </div>
                        <div class="control-group">

                        <table border="0" style="width:80%">
                        <tr style="height:50px;">
                        <td style="width:80px; padding-right:20px;" align="right">
                                真实姓名(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                <input type="text" class="span4 {required:true,cn:true}" id="txtrealName" name="RealName"
                                    style="width: 250px" placeholder="请输入您的真实姓名" />
                            </td>
                        <td style="width:80px; padding-right:20px;" align="right">
                                联系电话1(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                 <input type="text" placeholder="输入联系电话" name="Phone" class="span4 {required:true}" style="width: 250px" />
                            </td>
                        </tr></table> 

                        </div>
                        <div class="control-group">
                        <table border="0" style="width:80%">
                        <tr style="height:50px;">
                        <td style="width:80px; padding-right:20px;" align="right">
                                昵称(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                <input type="text" placeholder="输入用户昵称" name="NickName" class="span4 {required:true}" style="width: 250px" />
                            </td>
                        <td style="width:80px; padding-right:20px;" align="right">
                                联系电话2(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                  <input type="text" placeholder="输入联系电话" name="PhoneOne" class="span4 {required:true}" style="width: 250px" />
                              </td>
                        </tr></table> 

                        </div>
                       
                        <div class="control-group">
                        <table border="0" style="width:80%">
                        <tr style="height:50px;">
                        <td style="width:80px; padding-right:20px;" align="right">
                                身份证号(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                               <input type="text" class="span4 {required:true,number:true}" id="txtIdCardNo" style="width: 250px"
                                    name="IdCardNo" placeholder="请输入您的身份证号" /></td>
                        <td style="width:80px; padding-right:20px;" align="right">
                                QQ(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                   <input type="text" placeholder="输入QQ" name="QQ" class="span4 {required:true}" style="width: 250px" />
                           </td>
                        </tr></table>
                        </div>
                         <div class="control-group">
                         <table border="0" style="width:80%">
                        <tr style="height:50px;">
                        <td style="width:80px; padding-right:20px;" align="right">
                                性别(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                <select name="Gender" id="Gender" style="width: 80px">
                                    <option value="1">男</option>
                                    <option value="0">女</option>
                                </select>
                                </td>
                        <td style="width:80px; padding-right:20px;" align="right">
                                状态(<font color="#ff0000">*</font>)</td>
                        <td style="width:35%" align="left">
                                    <label><input type="hidden" id="IsRefuse" name="IsRefuse" />
                                <input type="checkbox" value="1" id="IsRefuseCHK"  />&nbsp;&nbsp;
                                    禁用</label>  </td>
                        </tr></table>

                        </div>
                       
                    </div>
                    <div>
                    @{
                        if (ViewBag.Error != null)
                            {
                                if (ViewBag.Error=="")
                                { 
                            <div  class="alert alert-success"><strong style="width:50%; margin:0px auto">操作成功！</strong></div>
                                }
                                else
                                {
                            <div  class="alert alert-error"><strong  style="width:50%; margin:0px auto">@ViewBag.Error</strong></div>
                                }
                            }
                        }
                        <div class="form-actions" style="text-align:center;">
                            <button type="submit" class="btn btn-primary">
                                保存</button>
                        </div>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript" src="/Scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/Scripts/jquery.metadata.js"></script>
    <script type="text/javascript" src="/scripts/select2.min.js"></script>
    <script type="text/javascript">
        //var validation = new plug.BindValidCode();
        $(function () {
            //validation.BindValidator();

            $('#regform').validate({
                errorClass: "help-inline",
                errorElement: "span",
                highlight: function (element, errorClass, validClass) {
                    $(element).parents('.control-group').addClass('error');
                },
                unhighlight: function (element, errorClass, validClass) {
                    $(element).parents('.control-group').removeClass('error');
                }
            });
            $("#IsRefuseCHK").click(function () {
                if ($("input:checked").length > 0) {
                    $("#IsRefuse").val("1");
                } else {
                    $("#IsRefuse").val("0");
                }
            });
        });
    </script>
    <script type="text/javascript">
        $(function () {
            $('#likUser').addClass('open');
            $('#likUser').addClass('active');

            $('#FloorId').each(function () {
                $(this).select2();
            });
            $('#SystemRole').each(function () {
                $(this).select2();
            });
            $('#Gender').each(function () {
                $(this).select2();
            });
        });
    </script>
}
